<%@ Import Namespace="System.IO" %>
<script  runat="server">
Sub Page_Load(ByVal sender As Object, _
	ByVal e As EventArgs)
	'Specify the directories you want to manipulate.
        Dim path As String = "c:\MyDir"
        Dim target As String = "c:\TestDir"

        Try
            ' Determine whethers the directory exists.
            If Directory.Exists(path) = False Then
                ' Create the directory.
                Directory.CreateDirectory(path)
            End If

            If Directory.Exists(target) Then
                ' Delete the target to ensure it is not there.
                Directory.Delete(target, True)
            End If

            ' Move the directory.
            Directory.Move(path, target)

            'Create a file in the directory.
            File.CreateText(target + "\myfile.txt")

            'Count the files in the target.
            Response.Write("The number of files " + _
	Directory.GetFiles(target).Length.toString())

        Catch err As Exception
            Response.Write("The process failed: " + _
	err.ToString())
        End Try    
End Sub
</script>


